//
//  BlackListCollectionViewCell.m
//  QT
//
//  Created by 甘世清 on 2025/1/13.
//

#import "BlackListCollectionViewCell.h"

@implementation BlackListCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.masksToBounds = YES;
        [self SQ_UIViewForSelfView];
    }
    return self;
}
/// 添加ui
-(void)SQ_UIViewForSelfView
{
    [self.contentView addSubview:self.headerView];
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    [self.contentView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.equalTo(self.contentView).offset(12);
            make.height.mas_equalTo(30);
    }];
    [self.contentView addSubview:self.genderImage];
    [self.genderImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.nameLabel);
            make.size.mas_equalTo(13);
        make.left.equalTo(self.nameLabel.mas_right).offset(2);
    }];
    
    [self.contentView addSubview:self.messageLabel];
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(12);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(8);
        make.right.equalTo(self.contentView.mas_right).offset(-12);
    }];
    
    [self.contentView addSubview:self.button];
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
        make.width.mas_equalTo(SCREEN_WIDETH/2.f-40);
        make.height.mas_equalTo(40);
    }];
}


- (void)setModel:(UserModel *)model{
    _model = model;
    [self.headerView sd_setImageWithURL:SQURLImage(@"https://saliao.qingtao.fun/files/saliao/ticket/IMG_8758.PNG") placeholderImage:SQGetImage(@"1")];
    self.nameLabel.text = @"名字名字";
    self.genderImage.image = SQGetImage(@"女");
    self.messageLabel.text = SQNSLocalString(@"这个人有点懒..");
 
}

 
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.font = FONT_MEDIUM(16);
        _nameLabel.textColor = SQColor333333;
        _nameLabel.backgroundColor = UIColor.clearColor;
        _nameLabel.numberOfLines = 0;
    }
    return _nameLabel;
}

- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [[UILabel alloc]init];
        _messageLabel.font = FONT_MEDIUM(14);
        _messageLabel.textColor = SQColor333333;
        _messageLabel.backgroundColor = UIColor.clearColor;
    }
    return _messageLabel;
}
 
- (UIImageView *)headerView{
    if (!_headerView) {
        _headerView = [[UIImageView alloc]init];
        _headerView.contentMode = UIViewContentModeScaleAspectFill;
        _headerView.clipsToBounds = YES;
        _headerView.layer.cornerRadius = 10;
        _headerView.layer.masksToBounds = YES;
    }
    return _headerView;
}

- (UIImageView *)genderImage{
    if (!_genderImage) {
        _genderImage = [[UIImageView alloc]init];
        _genderImage.image = SQGetImage(@"女");
    }
    return _genderImage;
}
 
- (SQCustomButton *)button{
    if (!_button) {
        _button = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(0, 0) midmargin:0];
        _button.text = SQNSLocalString(@"取消拉黑");
        _button.backgroundColor = SQHexColor(@"#000000", 0.5);
        _button.layer.cornerRadius = 10;
        _button.layer.masksToBounds = YES;
        _button.textColor = UIColor.whiteColor;
        _button.font = FONT_REGULAR(14);
    }
    return _button;
}

@end
